<template>
    <el-table-column
        prop=""
        label="归因"
        :filters="ascribeList"
        :filtered-value="ascribeIds"
        :width="200"
        column-key="ascribe_type"
    >
        <template slot-scope="scope">
            <!--
                非归因：自然量                                       （苹果token解密后是自然量的；没有收到巨量/广点通/荣耀/华为监测链接的）
                归因成功：广告主ID、广告计划ID、广告组ID、关键词ID    （苹果token解密成功的；有收到巨量/广点通/荣耀/华为监测链接的）
                无法归因                                             （苹果token3次解密失败的；oppo；vivo；小米）
            -->
            <template v-if="scope.row.ascribe_info && scope.row.ascribe_info.length > 0">
                <div v-for="(item, index) in scope.row.ascribe_info" :key="index">
                    <el-popover placement="top-start" :title="`${item.channel_key}信息`" width="600" trigger="hover" v-if="item.ascribe_type == 0">
                        <slot>
                            <div class="ads_layer">
                                <el-descriptions :column="1" border>
                                    <el-descriptions-item>
                                        <template slot="label">来源</template>
                                        {{ item.channel_key || "-" }}渠道的自然流量
                                    </el-descriptions-item>
                                </el-descriptions>
                            </div>
                        </slot>
                        <span slot="reference" class="ell">
                            <el-tag class="adsTag" size="small">{{ item.channel_key || "-" }}非归因</el-tag>
                        </span>
                    </el-popover>
                    <el-popover placement="top-start" :title="`${item.channel_key}信息`" width="600" trigger="hover" v-else-if="item.ascribe_type == 1">
                        <slot>
                            <div class="ads_layer">
                                <el-descriptions :column="3" border>
                                    <el-descriptions-item>
                                        <template slot="label">广告主ID</template>
                                        {{ item.ad_main_id || "-" }}
                                    </el-descriptions-item>
                                    <el-descriptions-item>
                                        <template slot="label">广告计划ID</template>
                                        {{ item.ad_plan_id || "-" }}
                                    </el-descriptions-item>
                                    <el-descriptions-item>
                                        <template slot="label">广告组ID</template>
                                        {{ item.ad_group_id || "-" }}
                                    </el-descriptions-item>
                                    <el-descriptions-item>
                                        <template slot="label">关键词ID</template>
                                        {{ item.ad_keyword_id || "-" }}
                                    </el-descriptions-item>
                                </el-descriptions>
                            </div>
                        </slot>
                        <span slot="reference" class="ell">
                            <el-tag class="adsTag" type="success" size="small">{{ item.channel_key || "-" }}归因</el-tag>
                        </span>
                    </el-popover>
                    <el-popover placement="top-start" :title="`${item.channel_key}信息`" width="600" trigger="hover" v-else-if="item.ascribe_type == 2">
                        <slot>
                            <div class="ads_layer">
                                <el-descriptions :column="3" border>
                                    <el-descriptions-item>
                                        <template slot="label">原因</template>
                                        <template v-if="item.channel_key == 'AppStore'">手机系统版本过低 / 苹果3次Token解密失败，无法归因</template>
                                        <template v-else-if="item.channel_key == 'huawei' || item.channel_key == 'honor'">因{{ item.channel_key || "-" }}渠道上报失败，无法归因</template>
                                        <template v-else-if="item.channel_key == 'oppo' || item.channel_key == 'vivo' || item.channel_key == 'xiaomi'">因{{ item.channel_key || "-" }}渠道全量上报，无法判断归因</template>
                                        <template v-else>因{{ item.channel_key || "-" }}渠道未接入归因，无法判断</template>
                                    </el-descriptions-item>
                                </el-descriptions>
                            </div>
                        </slot>
                        <span slot="reference" class="ell">
                            <el-tag class="adsTag" type="warning" size="small">{{ item.channel_key || "-" }}无法归因</el-tag>
                        </span>
                    </el-popover>
					<template v-else>-</template>
				</div>
            </template>
            <template v-else>-</template>
        </template>
    </el-table-column>
</template>

<script>
    export default {
        props: {
			
			// 归因选中的ID
            ascribeIds: {
                type: Array,
                default: [],
            },
			
			// 归因列表
            ascribeList: {
                type: Array,
                default: []
            },
			
        },
        data() {
            return {
                
            };
        },
        methods: {
            
        },
        mounted() {
            
        },
    };
</script>

<style lang="scss" scoped>
    .el_tabs {
        margin-bottom: 7px;
    }
</style>
